<?php if($this->CBS_ID > 0){ ?>  
<script>     
function proc_enc(){
    $.post('/admin/funcoes/reenviaremailsenha',{ CBS_ID:<?php echo $this->CBS_ID; ?> }, function(data){ 
        if(data.ok){ 
            $('#console').append(data.html);
        } else {
            alert(data.msg);
            window.location.href = '/admin/funcoes/enviaremail';
        }
    }, 'json');
}

setInterval(function(){  proc_enc(); }, 30000);

</script>
<div>Em processo de envio...</div>
 <?php } else { ?>  

<form id="form_filtro" method="post" action="">
    <i>Selecionar o curso para envio de login e senha por e-mail para alunos | "SE: ALUNO (ALU_STAEML = 0 e ALU_EML > "") "</i>
    <br><br>
    <?php
        $db = Zend_Db_Table_Abstract::getDefaultAdapter(); 
        
        $front = Zend_Controller_Front::getInstance();
        $itfiltro = $front->getRequest()->getParam('itfiltro', '');
        
        $query = 'SELECT SQL_CACHE CBS_ID,CBS_NOM FROM CURSOBASE WHERE CBS_STA = 1';
        $f_cur = $db->fetchAll($query);

        $html = '<select id="CBS_ID" name="CBS_ID" class="chosen-select" >';
        $html .= '<option value="">Nenhum</option>';
        foreach($f_cur as $r){   
            $select = $this->CBS_ID == $r['CBS_ID'] ? 'selected':''; 
            $html .= '<option '.$select.' value="'.$r['CBS_ID'].'">'.$r['CBS_NOM'].'</option>'; 
        }
        $html .= '</select>';
        echo $html;
    ?>
    <input type="submit" class="btn-pdr" name="buscar" value="buscar" />
</form>
 <?php } ?>  

<div id="console"></div>

